$(function(){
    var
        oPinpaiLi  = $ ('.ly-pinpai li'),
        oPinpaiA   = $ ('.ly-pinpai ul a'),
        oPinpaiSpan= $ ('.ly-pinpai span'),
        oYiXuan    = $ ('.ly-yixuan'),
        oYiXuanUl  = $ ('.ly-yixuan ul'),
        oZhongleiLi= $('.ly-zhonglei li'),
        oZhongleA   = $ ('.ly-zhonglei ul a'),
        oZhongleiSpan= $ ('.ly-zhonglei span'),
        oYixuanLi    = $('.ly-yixuan li');

      //事件委托
    oPinpaiLi.click(function(){
        var eIndex=$(this).index();
        oYiXuan.css({display:'block'});
        oYiXuanUl.append('<li><a href="javascript:;">'+oPinpaiSpan.html()+':'+oPinpaiA.eq(eIndex).html()+'<em>X</em></a></li>')
    });

    oZhongleiLi.click(function(){
        var eIndex=$(this).index();
        oYiXuan.css({display:'block'});
        oYiXuanUl.append('<li><a href="javascript:;">'+oZhongleiSpan.html()+':'+oZhongleA.eq(eIndex).html()+'<em>X</em></a></li>')
    });
    var
        oYiXuanEm  = $ ('.ly-yixuan .eme1');


    oYiXuanUl.click(function(){
        oYixuanLi.html('')
    });                        //那字符串拼接的获得不到


    var
        oLaoFoYeImg =  $('.li-list .img'),
        oLaoFoYeUl  =  $('.li-list .imgUl'),
        oLaoFoYeli  =  $('.laofoye-cont .li-list .img-list'),
        oLattleImg  =  $('.imgUl .lattle-img');
    oLaoFoYeli.mouseenter(function(){
       uIndex=$(this).index();
        oLaoFoYeUl.eq(uIndex).css({display:'block'})
    });
    oLaoFoYeli.mouseleave(function(){
        uIndex=$(this).index();
        oLaoFoYeUl.eq(uIndex).css({display:'none'})
    });
    var arr=[
        ['../images/3.2.jpg','../images/3.1.jpg'],
        ['../images/21d.jpg','../images/22d.jpg','../images/23d.jpg'],
        ['../images/31d.jpg','../images/32d.jpg'],
        ['../images/41d.jpg','../images/42d.jpg','../images/43d.jpg'],
        ['../images/51d.jpg','../images/52d.jpg','../images/53d.jpg'],
        ['../images/61d.jpg','../images/62d.jpg','../images/63d.jpg'],
        ['../images/71d.jpg','../images/72d.jpg','../images/73d.jpg'],
        ['../images/81d.jpg','../images/82d.jpg','../images/83d.jpg'],
        ['../images/81d.jpg','../images/82d.jpg','../images/83d.jpg'],
        ['../images/101d.jpg','../images/102d.jpg'],
        ['../images/112d.jpg','../images/112d.jpg'],
        ['../images/121d.jpg','../images/122d.jpg','../images/123d.jpg'],
        ['../images/131d.jpg','../images/132d.jpg','../images/133d.jpg'],
        ['../images/141d.jpg','../images/142d.jpg'],
        ['../images/151d.jpg','../images/152d.jpg'],
        ['../images/161d.jpg','../images/162d.jpg','../images/163d.jpg'],
        ['../images/171d.jpg','../images/172d.jpg','../images/173d.jpg'],
        ['../images/181d.jpg','../images/182d.jpg','../images/183d.jpg'],
        ['../images/191d.jpg','../images/191d.jpg'],
        ['../images/201d.jpg','../images/202d.jpg'],
        ['../images/211d.jpg','../images/211d.jpg'],
        ['../images/221d.jpg','../images/222d.jpg','../images/223d.jpg'],
        ['../images/231d.jpg','../images/232d.jpg','../images/233d.jpg'],
        ['../images/241d.jpg','../images/242d.jpg'],
        ['../images/251d.jpg','../images/252d.jpg','../images/253d.jpg']

    ];
    oLattleImg.mouseenter(function(){
        var LIndex=$(this).index();
        console.log(LIndex);
        console.log(uIndex);
        $(this).css({border:'1px solid #000'});
        oLaoFoYeImg.eq(uIndex).attr({src:arr[uIndex][LIndex]})
    });
    oLattleImg.mouseleave(function(){
        var LIndex=$(this).index();
        oLattleImg.css({border:'1px solid #ccc'});
    });

    var
        spantime1=$('.daojishi .em1'),
        spantime2=$('.daojishi .em2'),
        spantime3=$('.daojishi .em3'),
        spantime4=$('.daojishi .em4');
    function timer(){
        var time = new Date();
        var time1 = new Date("2016/10/01");
        var cha = time1-time;
        var day = parseInt(cha/1000/60/60/24);
        var hour = parseInt(cha/1000/60/60%24);
        var minu = parseInt(cha/1000/60%60);
        var secon = parseInt(cha/1000%60);
        if(day>=10){
            day = day;
        }else{
            day = "0"+day;
        }
        if(hour>=10){
            hour = hour;
        }else{
            hour = "0"+hour;
        }
        if(minu>=10){
            minu = minu;
        }else{
            minu = "0"+minu;
        }
        if(secon>=10){
            secon = secon;
        }else{
            secon = "0"+secon;
        }
        spantime1.html(day);
        spantime2.html(hour);
        spantime3.html(minu);
        spantime4.html(secon);
    }
    setInterval(timer,1000);
});

